# Contributor: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
# Maintainer: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
pkgname=captagent
pkgver=6.3.1
pkgrel=1
pkgdesc="HEP Capture Agent for HOMER"
url="https://github.com/sipcapture/captagent"
arch="all"
license="GPL-3.0-or-later"
makedepends="autoconf automake bison expat-dev flex flex-dev json-c-dev
             libgcrypt-dev libpcap-dev libtool libuv-dev linux-headers openssl-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/sipcapture/captagent/archive/$pkgver.tar.gz
	$pkgname.initd
	"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"

	./build.sh
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc
	make
}

check() {
	cd "$builddir"
	./src/captagent -v
}

package() {
	cd "$builddir"

	make install DESTDIR="$pkgdir"
	rm "$pkgdir"/usr/lib/$pkgname/modules/*.a

	install -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="e4043ddb92a1228fb9e4e220e503e3bd0bf9009c893e9c153fc90d15f91902ff7b86ca4b01bf2ef40056bc16647a3838fcfb88f76503f41f4bea88d054e4d7de  captagent-6.3.1.tar.gz
750326291fc65fa9a3568f6961f2d6b950baa715e75ad7fc8263956cc91c50445e2e041d8f73675a350ba0d55786908564b439396376d8105fb69332e8aefc27  captagent.initd"
